services:
  prometheus:
    image: registry.cn-hangzhou.aliyuncs.com/weizhihui/prometheus:v2.51.2
    container_name: prometheus
    restart: always
    user: root
    ports:
      - "9095:9090"
    volumes:
      - {{ monitoring_volumes }}/prometheus/data:/prometheus
      - {{ monitoring_volumes }}/prometheus/conf:/etc/prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yaml'
    networks:
      - monitoring

  grafana:
    image: registry.cn-hangzhou.aliyuncs.com/weizhihui/grafana:10.4.2
    container_name: grafana
    restart: always
    ports:
      - "3000:3000"
    volumes:
      - {{ monitoring_volumes }}/grafana:/var/lib/grafana
    networks:
      - monitoring
  
  alertmanager:
    image: registry.cn-hangzhou.aliyuncs.com/weizhihui/alertmanager:v0.27.0
    container_name: alertmanager
    restart: always
    ports:
      - "9093:9093"
    volumes:
      - {{ monitoring_volumes }}/alertmanager:/etc/alertmanager
    command:
      - '--config.file=/etc/alertmanager/alertmanager.yaml'
    networks:
      - monitoring
  
  prometheus-webhook-dingtalk:
    image: registry.cn-hangzhou.aliyuncs.com/weizhihui/prometheus-webhook-dingtalk:v2.1.0
    container_name: webhook-dingtalk
    restart: always
    ports:
      - "8060:8060"
    volumes:
      - {{ monitoring_volumes }}/webhook-dingtalk:/etc/prometheus-webhook-dingtalk
    command:
      - '--config.file=/etc/prometheus-webhook-dingtalk/config.yaml'
    networks:
      - monitoring

  pushgateway:
    image: registry.cn-hangzhou.aliyuncs.com/weizhihui/pushgateway:v1.8.0
    container_name: pushgateway
    restart: always
    ports:
      - '9096:9091'
    networks:
      - monitoring
  
  node-exporter:
    image: registry.cn-hangzhou.aliyuncs.com/weizhihui/node-exporter:v1.8.0
    container_name: node-exporter
    restart: always
    ports:
      - "9100:9100"
    networks:
      - monitoring

  mysql-exporter:
    image: registry.cn-hangzhou.aliyuncs.com/weizhihui/mysqld-exporter:v0.15.1
    container_name: mysqld-exporter
    restart: always
    ports:
      - "9104:9104"
    volumes:
      - {{ monitoring_volumes }}/mysqld_exporter:/etc/mysqld_exporter
    command:
      - '--config.my-cnf=/etc/mysqld_exporter/my.cnf'
    networks:
      - monitoring

  redis-exporter:
    image: registry.cn-hangzhou.aliyuncs.com/weizhihui/redis_exporter:v1.59.0
    container_name: redis_exporter
    restart: always
    environment:
      - REDIS_ADDR=redis://{{ ansible_host }}:{{ redis.port }}
      - REDIS_PASSWORD={{ redis.password }}
    ports:
      - '9121:9121'
    networks:
      - monitoring

  phpmyadmin:
    image: registry.cn-hangzhou.aliyuncs.com/weizhihui/phpmyadmin:5.2.1
    container_name: phpmyadmin
    ports:
      - '9082:80'
    environment:
      - PMA_ARBITRARY=1
      - PMA_HOST={{ ansible_host }}
      - PMA_PORTS={{ mysql.port }}
    networks:
      - monitoring
      
  phpredisadmin:
    image: registry.cn-hangzhou.aliyuncs.com/weizhihui/phpredisadmin:1.19.3
    container_name: phpredisadmin
    restart: always
    ports:
      - '9081:80'
    environment:
      - ADMIN_USER=admin
      - ADMIN_PASS=admin
      - REDIS_1_HOST={{ ansible_host }}
      - REDIS_1_AUTH={{ redis.password }}
      - REDIS_1_PORT={{ redis.port }}
    networks:
      - monitoring
  
  kuboard:
    image: registry.cn-hangzhou.aliyuncs.com/weizhihui/kuboard:v3
    container_name: kuboard
    restart: always
    ports:
      - '2080:80'
      - '10081:10081'
    volumes:
      - {{ monitoring_volumes }}/kuboard-data:/data
    environment:
      - KUBOARD_ENDPOINT=http://{{ ansible_host }}:2080
      - KUBOARD_AGENT_SERVER_TCP_PORT=10081
    networks:
      monitoring:
  
  kafka-ui:
    container_name: kafka-ui
    image: registry.cn-hangzhou.aliyuncs.com/weizhihui/kafka-ui:v0.7.2
    restart: always
    ports:
      - 9083:8080
    environment:
      DYNAMIC_CONFIG_ENABLED: true
    volumes:
      - {{ monitoring_volumes }}/kui:/etc/kafkaui
    networks:
      monitoring:

  kafka-exporter:
    container_name: registry.cn-hangzhou.aliyuncs.com/weizhihui/kafka-exporter:v1
    image: danielqsj/kafka-exporter
    restart: always
    command: ["--kafka.server={{ ansible_host }}:9092"]
    ports:
      - 9308:9308
    networks:
      monitoring:
  
  guacd:
    image: registry.cn-hangzhou.aliyuncs.com/weizhihui/guacd:1.5.5
    container_name: guacd
    restart: always
    volumes:
      - {{ monitoring_volumes }}/guacd:/usr/local/next-terminal/data
    networks:
      monitoring:

  next-terminal:
    image: registry.cn-hangzhou.aliyuncs.com/weizhihui/next-terminal:v1.3.9
    container_name: next-terminal
    restart: always
    environment:
      - DB=mysql
      - MYSQL_HOSTNAME={{ ansible_host }}
      - MYSQL_PORT={{ mysql.port }}
      - MYSQL_USERNAME={{ mysql.user }}
      - MYSQL_PASSWORD={{ mysql.password }}
      - MYSQL_DATABASE={{ mysql.database }}
      - GUACD_HOSTNAME=guacd
      - GUACD_PORT=4822
    ports:
      - "8088:8088"
    volumes:
      - /etc/localtime:/etc/localtime
      - {{ monitoring_volumes }}/next-terminal:/usr/local/next-terminal/data
    networks:
      monitoring:

networks:
  monitoring:
